﻿@model TCCVoigt.Models.SolicitacaoMudanca

@{
    ViewBag.Title = "Create";
}

<h2>Adicionar</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.maskedinput-1.3.min.js")" type="text/javascript"></script>

<script type="text/javascript">
    function verificaNumero(e) {
        if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
            return false;
        }
    }
    $(document).ready(function () {
        $('#DataSolicitacao').mask('99/99/9999');
        $('#PrazoCliente').mask('99/99/9999');
        $('#DataSolicitacao').datepicker({ dateFormat: "dd/mm/yy" });
        $('#PrazoCliente').datepicker({ dateFormat: "dd/mm/yy" });

        $("#CodigoCliente").change(function () {
            $.getJSON('@Url.Action("ListaSolicitante", "SolicitacaoMudanca")', { cliente: $(this).val() }, function (data) {
                $("#CodigoSolicitante").empty();
                $.each(data, function (index, optionData) {
                    $("#CodigoSolicitante").append("<option value='" + optionData.Value + "'>" + optionData.Text + "</option>");
                });
            });
        });

        $("#CodigoSistema").change(function () {
            $.getJSON('@Url.Action("ListaModulo", "SolicitacaoMudanca")', { sistema: $(this).val() }, function (data) {
                $("#CodigoModulo").empty();
                $("#CodigoModulo").append("<option value=''></option>");
                $("#CodigoRequisito").empty(); //limpa os requisitos
                $.each(data, function (index, optionData) {
                    $("#CodigoModulo").append("<option value='" + optionData.Value + "'>" + optionData.Text + "</option>");
                });
            });
        });

        $("#CodigoModulo").change(function () {
            $.getJSON('@Url.Action("ListaRequisito", "SolicitacaoMudanca")', { modulo: $(this).val() }, function (data) {
                $("#CodigoRequisito").empty();
                $("#CodigoRequisito").append("<option value=''></option>");
                $.each(data, function (index, optionData) {
                    $("#CodigoRequisito").append("<option value='" + optionData.Value + "'>" + optionData.Text + "</option>");
                });
            });
        });

        $("#HoraAnaliseNegocio").keypress(verificaNumero);
        $("#HoraAnaliseSistema").keypress(verificaNumero);
        $("#HoraProgramacao").keypress(verificaNumero);
        $("#HoraTeste").keypress(verificaNumero);
        $("#HoraDocumentacao").keypress(verificaNumero);

    });
</script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>SolicitacaoMudanca</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Numero)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Numero)
            @Html.ValidationMessageFor(model => model.Numero)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Solicitacao)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Solicitacao, new { style = "width:350px;" })
            @Html.ValidationMessageFor(model => model.Solicitacao)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Descricao)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Descricao)
            @Html.ValidationMessageFor(model => model.Descricao)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.DataSolicitacao)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.DataSolicitacao)
            @Html.ValidationMessageFor(model => model.DataSolicitacao)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PrazoCliente)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PrazoCliente)
            @Html.ValidationMessageFor(model => model.PrazoCliente)
        </div>

        <div class="editor-label">
            <label>Cliente</label>
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoCliente", String.Empty)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CodigoSolicitante, "Solicitante")
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoSolicitante", String.Empty)
            @Html.ValidationMessageFor(model => model.CodigoSolicitante)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CodigoPrioridade, "Prioridade")
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoPrioridade", String.Empty)
            @Html.ValidationMessageFor(model => model.CodigoPrioridade)
        </div>

        <div class="editor-label">
            <label>Sistema</label>
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoSistema", String.Empty)
        </div>

        <div class="editor-label">
            <label>Módulo</label>
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoModulo", String.Empty)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CodigoRequisito, "Requisito")
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoRequisito", String.Empty)
            @Html.ValidationMessageFor(model => model.CodigoRequisito)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CodigoProjeto, "Projeto")
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoProjeto", String.Empty)
            @Html.ValidationMessageFor(model => model.CodigoProjeto)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CodigoStatus, "Status")
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoStatus", String.Empty)
            @Html.ValidationMessageFor(model => model.CodigoStatus)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CodigoTipoSolicitacao, "TipoSolicitacao")
        </div>
        <div class="editor-field">
            @Html.DropDownList("CodigoTipoSolicitacao", String.Empty)
            @Html.ValidationMessageFor(model => model.CodigoTipoSolicitacao)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.HoraAnaliseNegocio, "Horas Analise Negócio")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HoraAnaliseNegocio)
            @Html.ValidationMessageFor(model => model.HoraAnaliseNegocio)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.HoraAnaliseSistema, "Horas Analise Sistema")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HoraAnaliseSistema)
            @Html.ValidationMessageFor(model => model.HoraAnaliseSistema)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.HoraProgramacao, "Horas Programação")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HoraProgramacao)
            @Html.ValidationMessageFor(model => model.HoraProgramacao)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.HoraTeste, "Horas Testes")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HoraTeste)
            @Html.ValidationMessageFor(model => model.HoraTeste)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.HoraDocumentacao, "Horas Documentação")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HoraDocumentacao)
            @Html.ValidationMessageFor(model => model.HoraDocumentacao)
        </div>

        <p>
            <input type="submit" value="Gravar" />
        </p>
    </fieldset>
}

<div>
    <a href="@Url.Action("Index")"><img src="~/Images/ico_back.png" alt="" border="0" style="float: left"/>Voltar</a>
</div>
